home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Business Master (3rd Edition)
/
The Business Master (3rd Edition).iso
/
files
/
wordmisc
/
banner
/
fsy.asm
< prev
next >
Wrap
Assembly Source File
|
1986-09-06
|
14KB
|
493 lines
COMMENT ;
FSY.ASM The assembly language routines for the
FONTSY banner printer. The main program is written
for the Microsoft QuickBASIC compiler. 8/25/86
(C) Copyright 1985, 1986 Merlin R. Null
;
DATA SEGMENT BYTE PUBLIC 'DATA'
NO EQU 0
YES EQU NOT NO
;Set to YES if you are going to use a snowy color card
No_Snow EQU YES
;-----------------------------------------------------------------
; 0 BLACK 4 RED 8 GRAY 12 LIGHT RED
; 1 BLUE 5 MAGENTA 9 LIGHT BLUE 13 LIGHT MAGENTA
; 2 GREEN 6 BROWN 10 LIGHT GREEN 14 YELLOW
; 3 CYAN 7 WHITE 11 LIGHT CYAN 15 HIGH-INTENSITY WHITE
; Location Used
GreenOnBlack EQU 0AH ;most text
RedOnBlue EQU 1CH ;option 4
YellowOnBlue EQU 1EH ;main title
WhiteOnGreen EQU 2FH ;option 2
WhiteOnCyan EQU 3FH ;option menu
WhiteOnRed EQU 4FH ;loading font
WhiteOnMagenta EQU 5FH ;option 3
;-----------------------------------------------------------------
Mono_SegAddr EQU 0B000H ;address of monochrome buffer
Graph_SegAdr EQU 0B800H ;address of graphics buffer
TitleMes DB ' ╔',76 DUP (205),'╗ '
DB ' ║ FONTSY version 2.1 9/6/86 (C) Copyright '
DB '1985, 1986 Merlin R. Null ║ '
DB ' ╚',76 DUP (205),'╝ ',0
Fontin1 DB 'Prints banners using fonts created by FONTCODE'
DB 30,6,1,1,1,1
DB 'Enter the name of the font you wish to use'
DB 30,2,1,1,1
DB 'Examples:',4,'KIWI',6,'Use the font named KIWI.FNT'
DB 30,13
DB 'A:',8,'List of fonts on drive A:',30,15
DB '\FNTS\',4,'List of fonts on subdirectory',0
FontPromptDat DB 'Font name, Drive or Path ?',0
FrameDat DB ' ╔',27 DUP (205),'╗ ',30,19
DB ' ║ ',23,' ║ ',30,19
DB ' ╚',27 DUP (205),'╝ ',0
LoadFontMes DB ' Loading Font ',0
AvailText DB 'Available characters are:',0
BannerPrompt DB '<Return> for options, ^C to exit',26,1,1,1
DB 'Banner text ?',0
OptMenuTitle DB ' Font Options ',0
MenuDat DB '1 Change fonts',23,'is:',30,9,1
DB '2 Set column to start printing',7,'is:'
DB 30,9,1
DB '3 Set print character',16,'is:',30,9,1
DB '4 Set banner spacing',17,'is:',30,9,1
DB '5 Toggle character width',13,'is:',30,9,1
DB '6 Toggle character height',12,'is:',30,9,1
DB '7 Printer initialization string',30,18,1
DB '8 Save changes to disk',30,27,1
DB '<Return> Enter banner text',30,15,1,1
DB 'Option or <Return> ?',0
Option2Title DB ' Left Margin ',0
Option2Dat DB 'Printing now starts at column',29,1,1,1,12
DB 'Set the left margin to center a banner or allow two'
DB 29,1
DB 'lines of a smaller font. Allow room for descenders.'
DB 30,6,1,1,1
DB '<Return> retains the current value',25,1,1,1,1
DB 'Column to start printing (1-230) ?',0
Option3Title DB ' Print Character ',0
Option3Dat DB 'Current print character:',30,11,1,1
DB 'The single character used by FONTSY to print all '
DB 'large letters can',13,1
DB 'be set to any printable character. Use a single '
DB 'keystroke OR enter',13,1
DB 'a minimum of two decimal numbers to use the ASCII '
DB 'value. Example:',13,1
DB 'Character 239 on the Gemini-10X is a 6 by 6 graphic '
DB 'square. Enter',13,1
DB '255 to print each large character with its'
DB ' own small character.',31,1,1
DB '<Return> retains the current value',26,1,1,1
DB 'Character or decimal value ?',0
Option4Title DB 'Rows Between Characters',0
Option4Dat DB 'Current value:',30,1,1,1,12
DB 'The number of rows between large characters may be '
DB 'set from 0 to 99',7,1,1,1,22
DB '<Return> retains the current value'
DB 24,1,1,1,1,1,1
DB 'Number of rows ?',0
Option7Title DB 'Printer Initialiaztion ',0
Option7Dat DB 'An initialization string may be optionally sent to '
DB 'the printer',18
DB 'to set pitch, linefeeds or other funtions. This may'
DB ' be set to',18
DB 'different values for each font. Please consult your'
DB ' printer',20
DB 'manual for exact details. Enter a bare return for '
DB 'no change,',19
DB '999 for no initialization string.',0
Option7aTitle DB ' Printer Reset String ',0
Option7aDat DB 'A printer reset string should be sent to set printer'
DB ' back to',20
DB 'defaults. It is preferable to reset all functions '
DB 'set with',21
DB 'the initialization string rather than use a command '
DB 'to reset',20
DB 'everything.',0
Option7bDat DB 'Enter each byte of the printer command string with '
DB 'the decimal',18
DB 'value of each character. Terminate input with a '
DB 'bare <Return>',0
Option8Title DB ' Save the Current Font ',0
Display_Table DB 2DH,29H ;display re-enable values for
; modes 2 and 3
Display_Mode DW 0 ;current crt display mode
AtrByte DB 0
DATA ENDS
DGROUP GROUP DATA
CODE SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:CODE, DS:DGROUP
PUBLIC FontScr,FontPrompt,DoTitle,LoadingFont,OptionMenu
PUBLIC GetBanner,OptionScr2,OptionScr3,OptionScr4
PUBLIC OptionScr7,OptionScr7a,OptionScr7b,OptionScr8
PUBLIC WindowScroll
Main PROC FAR
;--------------------------------------------------------------------
DoTitle: PUSH BP
MOV BP,SP
CALL ClrScr
MOV AtrByte,YellowOnBlue
LEA SI,TitleMes
XOR DX,DX ;row 0 column 0
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
FontScr: PUSH BP
MOV BP,SP
MOV AtrByte,GreenOnBlack
LEA SI,FontIn1
MOV DX,030FH ;row 3 column 15
CALL ISRTSTR
POP BP
RET
;--------------------------------------------------------------------
FontPrompt: PUSH BP
MOV BP,SP
MOV AtrByte,GreenOnBlack
LEA SI,FontPromptDat
MOV DX,1700H ;row 23 column 0
CALL ISRTSTR
POP BP
RET
;--------------------------------------------------------------------
LoadingFont: PUSH BP
MOV BP,SP
MOV AtrByte,WhiteOnRed
LEA SI,FrameDat
MOV DX,0A17H ;row 10 column 23
CALL IsrtStr
LEA SI,LoadFontMes
MOV DX,0B1BH ;row 11 column 27
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
GetBanner: PUSH BP
MOV BP,SP
MOV AtrByte,GreenOnBlack
LEA SI,AvailText
MOV DX,091AH ;row 9 column 26
CALL IsrtStr
LEA SI,BannerPrompt
MOV DX,1216H ;row 18 column 22
CALL ISRTSTR
POP BP
RET
;--------------------------------------------------------------------
OptionMenu: PUSH BP
MOV BP,SP
CALL ClrScr
MOV ATRBYTE,WhiteOnCyan
LEA SI,FrameDat
MOV DX,0017H ;row 0 column 23
CALL IsrtStr
LEA SI,OptMenuTitle
MOV DX,011BH ;row 1 column 27
CALL IsrtStr
MOV AtrByte,GreenOnBlack
LEA SI,MenuDat
MOV DX,0409H ;row 4 column 9
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
OptionScr2: PUSH BP
MOV BP,SP
CALL ClrScr
MOV AtrByte,WhiteOnGreen
LEA SI,FrameDat
MOV DX,0017H ;row 0 column 23
CALL IsrtStr
LEA SI,Option2Title
MOV DX,011BH ;row 1 column 27
CALL IsrtStr
MOV AtrByte,GreenOnBlack
LEA SI,Option2Dat
MOV DX,0717H ;row 7 column 23
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
OptionScr3: PUSH BP
MOV BP,SP
CALL ClrScr
MOV AtrByte,WhiteOnMagenta
LEA SI,FrameDat
MOV DX,0017H ;row 0 column 23
CALL IsrtStr
LEA SI,Option3Title
MOV DX,011BH ;row 1 column 27
CALL IsrtStr
MOV AtrByte,GreenOnBlack
LEA SI,Option3Dat
MOV DX,0515H ;row 5 column 21
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
OptionScr4: PUSH BP
MOV BP,SP
CALL ClrScr
MOV AtrByte,RedOnBlue
LEA SI,FrameDat
MOV DX,0017H ;row 0 column 23
CALL IsrtStr
LEA SI,Option4Title
MOV DX,011BH ;row 1 column 27
CALL IsrtStr
MOV AtrByte,GreenOnBlack
LEA SI,Option4Dat
MOV DX,081EH ;row 8 column 30
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
OptionScr7: PUSH BP
MOV BP,SP
CALL ClrScr
MOV AtrByte,WhiteOnCyan
LEA SI,FrameDat
MOV DX,0017H ;row 0 column 23
CALL IsrtStr
LEA SI,Option7Title
MOV DX,011BH ;row 1 column 27
CALL IsrtStr
MOV AtrByte,GreenOnBlack
LEA SI,Option7Dat
MOV DX,0508H ;row 5 column 8
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
OptionScr7a: PUSH BP
MOV BP,SP
CALL ClrScr
MOV AtrByte,WhiteOnMagenta
LEA SI,FrameDat
MOV DX,0017H ;row 0 column 23
CALL IsrtStr
LEA SI,Option7aTitle
MOV DX,011BH ;row 1 column 27
CALL IsrtStr
MOV AtrByte,GreenOnBlack
LEA SI,Option7aDat
MOV DX,0508H ;row 5 column 8
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
OptionScr7b: PUSH BP
MOV BP,SP
LEA SI,Option7bDat
MOV DX,0B08H ;row 5 column 8
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
OptionScr8: PUSH BP
MOV BP,SP
CALL ClrScr
MOV AtrByte,WhiteOnGreen
LEA SI,FrameDat
MOV DX,0017H ;row 0 column 23
CALL IsrtStr
LEA SI,Option8Title
MOV DX,011BH ;row 1 column 27
CALL IsrtStr
POP BP
RET
;--------------------------------------------------------------------
;Scroll Window area. Called from BASIC with ULCorner which is put
;in CX and LRCorner to DX
WindowScroll: PUSH BP
MOV BP,SP
MOV BX,[BP]+8 ;upper left
MOV CX,[BX]
MOV BX,[BP]+6 ;lower right
MOV DX,[BX]
MOV BH,7 ;normal screen attribute
MOV AX,0601H ;scroll active window 1 line
INT 10H ;call BIOS
POP BP
RET 4
;--------------------------------------------------------------------
Main ENDP
;********************************************************************
;******** Start of Subroutines Local to the Assembler Module ********
;********************************************************************
;Clear the Screen and Home
ClrScr PROC NEAR
MOV CX,0 ;upper left
MOV DX,184FH ;lower right
MOV AX,0600H ;scroll active page
MOV BH,7 ;normal screen attribute
INT 10H ;call BIOS
MOV DX,0 ;row 0, column 0
;fall through to LOCATE
ClrScr ENDP
;--------------------------------------------------------------------
;Direct Cursor Addressing
Locate PROC NEAR
PUSH BX
MOV AH,2 ;request move cursor
MOV BH,0 ;page #0
INT 10H ;call BIOS
POP BX
RET
Locate ENDP
;--------------------------------------------------------------------
;Insert String Directly in the Video Buffer
IsrtStr PROC NEAR
PUSH ES
IF No_Snow
CALL Video_Disable ;turn display off for
; snow-free writing
ENDIF
CALL Calc_Vid_Offset ;calc offset into video buffer
MOV DI,AX ;offset was returned in AX
MOV DH,AtrByte ;get the attribute byte
CALL Set_Vid_Addr ;set the monochrome or graphics
MOV ES,AX ;video buffer address into ES
Isrt_Loop: MOV DL,BYTE PTR[SI]
CMP DL,0
JE IsrtStr_EXIT ;exit if end of string
CMP DL,31 ;control character?
JA Isrt_Word ;no, use the character
CMP DL,1
JZ SKIP_80
XOR DH,DH
ADD DI,DX ;yes, move pointer ahead
ADD DI,DX ;2 X ASCII of character
MOV DH,AtrByte ;restore attribute byte
JMP SHORT Nxt_Byte
Skip_80: ADD DI,0A0H ;skip next 80 positions
JMP SHORT Nxt_Byte
Isrt_Word: MOV ES:WORD PTR[DI],DX ;move char and attr to crt buf
ADD DI,2 ;point to next crt buf loc
NXT_BYTE: ADD SI,1 ;point to next string byte
JMP SHORT ISRT_LOOP ;move another word
IsrtStr_EXIT:
IF No_Snow
CALL Video_Enable ;video back on if CGA
ENDIF
POP ES
RET
IsrtStr ENDP
;--------------------------------------------------------------------
;Set Video Address
Set_Vid_Addr PROC NEAR
CALL Get_Mode ;get crt mode
CMP AL,7 ;is it monochrome
JNE Its_Graphics
MOV AX,Mono_Segaddr ;monochrome buffer seg addr
RET
Its_Graphics: MOV AX,Graph_Segadr ;graphics buffer seg address
RET
Set_Vid_Addr ENDP
;--------------------------------------------------------------------
;Calculate Video Address
Calc_Vid_Offset PROC NEAR
MOV AX,160 ;number of bytes in row
MUL DH ;row * 160
SHL DL,1 ;column * 2
XOR DH,DH ;byte to word
ADD AX,DX ;(row *160)+(column*2)
MOV DI,AX ;set offset in DI
RET
Calc_Vid_Offset ENDP
;--------------------------------------------------------------------
;Get Video Mode.
;Returns CRT mode in AL and the number of character columns on the
;screen in AH.
Get_Mode PROC NEAR
MOV AH,0FH
INT 10H
RET
Get_Mode ENDP
;---------------------------------------------------------------------------
;VIDEO_ENABLE and VIDEO_DISABLE routines manipulate bit 3 of port 3D8h,
;the CGA Mode Control Register, to temporarily turn the display on or off.
;These routines write directly to hardware, and have no effect on other
;video adapters.
IF No_Snow
Video_Disable PROC NEAR
PUSH DX
CALL Get_Mode ;get crt mode
CMP AL,7 ;is it monochrome
JE Disable2
MOV DX,3DAH ;read CGA status port
Disable1: IN AL,DX ;wait for vertical retrace to
;occur
TEST AL,8 ;is bit 3 set?
JE Disable1 ;no, wait until it is
MOV DX,3D8H ;now disable the display
MOV AL,25H ;by clearing bit 3 of the Mode
; Control Register
OUT DX,AL
Disable2: POP DX
RET
Video_Disable ENDP
;---------------------------------------------------------------------------
Video_Enable PROC NEAR
CALL Get_Mode ;get crt mode
CMP AL,7 ;is it monochrome
JE Enable2
XOR AH,AH ;eliminate columns info
MOV DX,3D8H ;CGA Mode Control Register
MOV BX,AX ;video mode to BX
SUB BX,2
MOV AL,Display_Table[BX]
OUT DX,AL ;and send it to the port
Enable2: RET
Video_Enable ENDP
ENDIF
CODE ENDS
END